<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-menu default-active='active' mode='horizontal' class='menu-unit'>
      <el-menu-item v-for='item in Container1' :index="'公司文件'===item.name?'active':'default'">
        <el-link @click="gotoMenu(item.url)" :type="'公司文件'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
      </el-menu-item>
    </el-menu>
    <table cellpadding="4" cellspacing="0" border="0" width="100%">
      <tr>
        <td class="containerBack">
          <el-form ref="form" :model="s_search" :rules="rules" label-width="100px" id="mvcfm">
            <div class="form-unit">
              <span class="mvc-title-left"> 搜索文件 </span>
            </div>
            <div>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="文件名" prop="client_filename">
                    <el-input v-model="s_search.client_filename" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="搜索" prop="">
                    <a href="javascript:mvc.submitURL('gotoPage('/oa/communication/CompanyFileChoice?')')" type='primary'>{{s_search['']}}</a>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
            <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>选择</el-button>
            <div class="form-unit">
              <span class="mvc-title-left"> 选择附件 </span>
            </div>
            <el-table :data="accounts" @selection-change="handleSelectionChange">
              <el-table-column label="#" align="center" type='selection'>
              </el-table-column>
              <el-table-column label="预览" prop="item_id">
                <template slot-scope="scope">
                  <el-link @click="gotoPage('/xcapi/ProcessFile/DownloadFile.do?&fileid='+scope.row.item_id+''+vueparams+'')" type='primary'>{{scope.row.client_filename}}</el-link>
                </template>
              </el-table-column>
              <el-table-column label="大小" prop="size">
              </el-table-column>
              <el-table-column label="目录" prop="thisname">
              </el-table-column>
              <el-table-column label="类型" prop="folde_subject">
              </el-table-column>
              <el-table-column label="" prop="">
              </el-table-column>
            </el-table>
            <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
            <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>选择</el-button>
          </el-form>
        </td>
      </tr>
    </table>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'CompanyFileChoice',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_search: {
          client_filename: null,
        },
        accounts: [],
        loading: false,
        Container1: null,
        elcheck: [],
        multiple: true,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "862DFD0FBB2143AF8E80537D84D3B0F6",
        name: "邮箱文件",
        selected: "公司文件"
      }, 'Container1', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/communication/EmailAction/companyFileChoice?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      handleSelectionChange(selection) {
        this.elcheck = selection.map(item => item["item_id"]);
        this.single = selection.length != 1;
        this.multiple = !selection.length;
      },
    },
  }
</script>
